/*==============================================================================
            Copyright (c) 2013 Moritz Hader, Marcel Schrder
            All Rights Reserved.

	@file  HeimdallNative3DObject.h

	@brief This header provides the class-definitions of the HeimdallNative3DObject.
	The 3DObject capsulates the mesh and surface-data received from the java-instance
	of this program and provides functionality to create the corresponding
	OpenGL-information (like matrix-data)
   
   This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
================================================================================*/


#include <engine/HeimdallNativeSurface.h>

#include <egl/HeimdallGLUtilities.h>


HeimdallNativeSurface::HeimdallNativeSurface(){

}

HeimdallNativeSurface::~HeimdallNativeSurface(){

}

void HeimdallNativeSurface::loadJavaObject(JNIEnv* env, jobject nativeObj){

	__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Loading HeimdallSurface into its native counterpart.");

	//Handle to the Heimdall3DObject-Class
	jclass hdClass = env->GetObjectClass(nativeObj);

		if (hdClass == NULL){
			__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Error, could not load the HeimdallSurface-Object java-class into the ndk-environment.");
			return;
		}

	//Get the color-vector
	loadFloat4DArray(env, nativeObj, hdClass, "getColorFloat", &this->color);

}

/**
 * Copy the content of the color-vector to the given destination
 */
void HeimdallNativeSurface::getColor(H4DVector* color){
	memcpy(color, this->color, sizeof(H4DVector));
}
